home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_pyr_kidvsindy_1.cog < prev    next >
Text File  |  1999-11-15  |  8KB  |  367 lines

  1. # Jones 3D Cog Script
  2. #
  3. # pyr_KidVsIndy_1.cog
  4. #    
  5. # Kid meets Indy in the minecar tunnel
  6. #
  7. # [RKD] && [HB]
  8. #
  9. # (C) 1998 LucasArts Entertainment Company LLC. All Rights Reserved
  10. # ========================================================================================
  11.  
  12. symbols
  13. message startup
  14. message entered
  15. message    killed
  16.  
  17. # sector
  18. sector    trigger
  19.  
  20. # world things
  21. thing   player        local
  22. thing    indyactor
  23. thing   kid            nolink
  24. thing    hint12    
  25.  
  26. # actor lookthings
  27. thing    indylookend
  28.  
  29. # actor marks
  30. thing    indymarkend
  31. thing    actorstart
  32.  
  33. # cameras
  34. thing    thirdcam
  35. thing    insidecam
  36. thing    cam1spot                                local
  37.  
  38. # camera lookthings
  39. thing    insidecamlook
  40. thing    insidecamlook2
  41. thing    thirdcamlook
  42. thing    cam1look                                local
  43.  
  44. # hyena creation ghosts
  45. thing    hyenaghost1
  46. thing    hyenaghost2
  47.  
  48. # created hyena things
  49. thing    hyena1    local    mask=0x448 # Mask for player, weapons, and explosions
  50. thing    hyena2    local    mask=0x448 # Mask for player, weapons, and explosions
  51.  
  52. # template
  53. template    hyenamodel=hyena                    local
  54. template    tpl_ghost=ghost                        local
  55.  
  56. # animations
  57. keyframe    tocrossarms=0in_stand1_bd_2.key        local
  58. keyframe    crossarms=0in_stand2.key               local
  59. keyframe    handsout=0in_armsup_1_1.key            local
  60.  
  61. # Indy's lines
  62. sound   holeinhistory=pr05j01a.wav    local
  63. sound    anybodyhome=pr05j06.wav        local
  64. sound    dontworry=pr05j04.wav        local
  65. sound    hello=pr06j01.wav            local
  66.  
  67. # Nubian Kid's lines
  68. sound   isitsafe=pr05b03.wav        local
  69. sound    botherme=pr05b05.wav        local
  70. sound    notcoming=pr05b07.wav        local
  71.  
  72. # Victory music
  73. sound    victory=mus_gen_indy_b_motif1.wav    local
  74.  
  75. # variables
  76. int        visitnum=1                                local
  77. int        curvoice=0                                local
  78. int        curtrack=0                                local
  79. int        camsexist=0                                local
  80.  
  81. # cogs
  82. cog        c_hyena_maker    
  83.  
  84. # subroutines
  85. flex    startscene=0.0    local
  86. flex    endscene=0.0    local
  87. flex    fixcams=0.0        local
  88. flex    firstvisit=0.0    local
  89. flex    secondvisit=0.0    local
  90. flex    thirdvisit=0.0    local
  91. end
  92.  
  93. code
  94. startup:
  95.     sleep(.01);
  96.     
  97.     player = GetLocalPlayerThing();
  98.     
  99.     global8 = 0;
  100.     global3 = 0;
  101.     
  102.     # until created, make hyenas non-entities
  103.     hyena1 = -1;
  104.     hyena2 = -1;
  105.     return;
  106.  
  107. killed:
  108. # ---> hyenas
  109.     if ((GetSenderRef() != hyena1) && (GetSenderRef() != hyena2)) return;
  110.  
  111.     global8 = global8 + 1;
  112.     
  113.     if (GetSenderRef() == hyena1)
  114.     {
  115.         hyena1 = -1;
  116.     }
  117.     
  118.     if (GetSenderRef() == hyena2)
  119.     {
  120.         hyena2 = -1;
  121.     }
  122.  
  123.     if (global8 >= 11)
  124.     {
  125.         Print("all hyenas killed");
  126.         SetHintSolved(hint12);
  127.         sleep(.75);
  128.         PlaySoundLocal(victory, 1, 0, 0, 0);
  129.         return;
  130.     }
  131.     
  132.     return;
  133.  
  134. entered:
  135. # ---> Trigger sectors
  136.     
  137.     if (GetSenderRef() != trigger) return;
  138.     
  139.     # kid is destroyed after Indy first discovers he's not answering
  140.     if (kid == -1) return;
  141.  
  142.     # send message: tell hyenas to run away
  143.     SendMessage(c_hyena_maker, user1);
  144.  
  145.     # tell recently generated hyenas to run away too
  146.     if (hyena1 != -1)
  147.     {
  148.         AIFlee(hyena1, GetLocalPlayerThing());
  149.     }
  150.     
  151.     if (hyena2 != -1)
  152.     {
  153.         AIFlee(hyena2, GetLocalPlayerThing());
  154.     }
  155.  
  156.     # if all hyenas have been killed, no one at home
  157.     if (global8 >= 11)
  158.     {
  159.         visitnum = 3;
  160.     }
  161.     
  162.     # first visit
  163.     if (visitnum == 1)
  164.     {
  165.         # prepare player
  166.         if (MakeMeStop() == -1) return;
  167.         DeselectWeaponWait(player);
  168.         
  169.         call firstvisit;
  170.         
  171.         visitnum = 2;
  172.  
  173.         #generate a couple more hyenas
  174.         hyena1 = CreateThing(hyenamodel, hyenaghost1);
  175.         hyena2 = CreateThing(hyenamodel, hyenaghost2);
  176.         CaptureThing(hyena1);
  177.         CaptureThing(hyena2);
  178.         AISetFireTarget(hyena1, player);
  179.         AISetFireTarget(hyena2, player);
  180.         AISetInstinctWpntMode(hyena1);
  181.         AISetInstinctWpntMode(hyena2);
  182.     }
  183.     else if (visitnum == 2)
  184.     {
  185.         # prepare player
  186.         if (MakeMeStop() == -1) return;
  187.         DeselectWeaponWait(player);
  188.         
  189.         call secondvisit;
  190.     }
  191.     else if (visitnum == 3)
  192.     {
  193.         # prepare player
  194.         if (MakeMeStop() == -1) return;
  195.         DeselectWeaponWait(player);
  196.         
  197.         # indy finds an empty cave after meeting kid in the desert
  198.         call thirdvisit;
  199.         
  200.         # if kid not already gone, destroy him
  201.         if (kid > -1) DestroyThing(kid);
  202.         kid = -1;
  203.     }
  204.     
  205.     return;
  206.  
  207. firstvisit:
  208.     global3 = 4;    # kid is in mid-cutscene - prevents runaway kid
  209.     call startscene;    
  210.     
  211.     # "miners blew a hole in history"
  212.     curvoice = PlayVoice(indyactor, holeinhistory, 1, 0);
  213.     curtrack = PlayKey(indyactor, tocrossarms, 4, 0x12, 1);
  214.     curtrack = PlayKey(indyactor, crossarms, 4, 0x14, 0);
  215.     WaitForSound(curvoice);
  216.  
  217.     # FOR PLACEMENT OF INDYACTOR IN MARCUS
  218.     PRINTVECTOR(GETTHINGPOS(INDYACTOR));
  219.     
  220.     # "is it safe" -- indy reacts    
  221.     PlayVoice(kid, isitsafe, 1, 0);
  222.     sleep(.25);
  223.     
  224.     # camera moves outward, indy puts hands down
  225.     MoveToFrame(insidecam, 1, 2);
  226.     SetCameraInterpSpeed(2, 1.5);
  227.     SetCameraSecondaryFocus(2, insidecamlook2);
  228.     StopKey(indyactor, curtrack, 0.25);
  229.     sleep(1.5);
  230.     
  231.     # "don't worry" and indy gestures
  232.     curtrack = PlayKey(indyactor, handsout, 4, 0x12, 0);
  233.     PlayVoice(indyactor, dontworry, 1, 1);
  234.     sleep(.75);
  235.  
  236.     # "hyenas bother me"
  237.     PlayVoice(kid, botherme, 1, 0);
  238.     Sleep(5);
  239.  
  240.     call endscene;
  241.     global3 = 1;     # kid has been met by Indy
  242.     return;
  243.  
  244. secondvisit:
  245.     global3 = 4;    # kid is in mid-cutscene - prevents runaway kid
  246.     call startscene;
  247.  
  248.     PlayVoice(player, anybodyhome, 1, 1);
  249.     sleep(.75);
  250.     PlayVoice(kid, notcoming, 1, 1);
  251.     sleep(.75);
  252.  
  253.     call endscene;
  254.     global3 = 1;     # kid has been met by Indy
  255.     return;
  256.  
  257. thirdvisit:
  258.     # kid no longer there, Indy calls out in vain
  259.     StartCutscene(1);
  260.  
  261.     # Make cutscene stuff...
  262.     if (camsexist != 0)
  263.     {
  264.         DestroyThing(cam1spot);
  265.         DestroyThing(cam1look);
  266.     }
  267.     camsexist = 1;
  268.     cam1spot = CreateThing(tpl_ghost, player);
  269.     CaptureThing(cam1spot);
  270.     cam1look = CreateThing(tpl_ghost, player);
  271.     CaptureThing(cam1look);
  272.  
  273.     # Dolly cam...
  274.     MakeCamera2LikeCamera1(cam1spot, cam1look);
  275.     SetCameraLookInterp(2, 0);
  276.     SetCameraPosInterp(2, 0);
  277.     SetCameraInterpSpeed(2, 0.8);
  278.     SetCameraFocus(2, cam1spot);
  279.     SetCameraSecondaryFocus(2, cam1look);
  280.     SetCurrentCamera(2);
  281.     ResetCameraFOV(0, 0.0);
  282.     SetCameraLookInterp(2, 1);
  283.     SetCameraPosInterp(2, 1);
  284.     Sleep(0.01);
  285.     SetCameraFocus(2, thirdcam);
  286.     SetCameraSecondaryFocus(2, thirdcamlook);
  287.     Sleep(0.25);
  288.  
  289.     # Indy hails kid...
  290.     PlayVoice(player, anybodyhome, 1, 1);
  291.     sleep(1.0);
  292.  
  293.     # Restore...
  294.     SetCameraLookInterp(2, 0);
  295.     SetCameraPosInterp(2, 0);
  296.     SetCameraPosition(1, GetThingPos(thirdcam));
  297.     SetCurrentCamera(1);
  298.     EndCutscene();
  299.     ClearActorFlags(player, 0x200000);
  300.  
  301.     return;
  302.  
  303. startscene:
  304.     call fixcams;
  305.  
  306.     ResetThing(indyactor);
  307.  
  308.     StartCutscene(1);
  309.     CopyOrient(player, indyactor);
  310.     CopyPlayerHolsters(player, indyactor);
  311.     ClearThingFlags(indyactor, 0x80000);
  312.     SetActorFlags(player, 0x200000);
  313.     SetThingFlags(player, 0x80000);
  314.         
  315.     #jump inside for a look out
  316.     SetCameraFocus(2, insidecam);
  317.     SetCameraSecondaryFocus(2, insidecamlook);
  318.     SetCurrentCamera(2);
  319.     ResetCameraFOV(0, 0);
  320.     
  321.     # make indy look generally inward
  322.     SetThingMaxRotVel(indyactor, 150.0);
  323.     AISetLookThingEyeLevel(indyactor, kid);
  324.     AIWaitForStop(indyactor);
  325.     
  326.     SetCameraLookInterp(2, 1);
  327.     return;
  328.             
  329. endscene:
  330.     # indy turns and walks off camera
  331.     AISetMoveSpeed(indyactor, 1.0);
  332.     SetThingMaxRotVel(indyactor, 150.0);
  333.     AISetLookThing(indyactor, indylookend);
  334.     AIWaitForStop(indyactor);
  335.     AISetMoveThing(indyactor, indymarkend, 1);
  336.     
  337.     # replace player, etc.
  338.     TeleportThing(player, indyactor);
  339.     SetThingFlags(indyactor, 0x80000);
  340.     ClearThingFlags(player, 0x80000);
  341.     ClearActorFlags(player, 0x200000);
  342.     SetCameraPosition(1, GetThingPos(insidecam));
  343.     SetCurrentCamera(1);
  344.  
  345.     # put indy actor back in place
  346.     TeleportThing(indyactor, actorstart);
  347.  
  348.     # put inside camera and lookthing back
  349.     MoveToFrame(insidecam, 0, 20);
  350.     
  351.     call fixcams;
  352.     EndCutscene();
  353.     
  354.     return;
  355.  
  356. fixcams:
  357.     # reset camera settings
  358.     ResetCameraFOV(0, 0);
  359.     SetCameraPosInterp(2, 0);
  360.     SetCameraLookInterp(2, 0);
  361.     RestoreExtCam();
  362.     return;
  363.  
  364. end
  365.     
  366.         
  367.